$(function() {
	function format(partiesinfo) {
		return partiesinfo.companyname + " &lt;" + partiesinfo.companyshortname + "&gt";
	}
	$("#COMPANYNAME").autocomplete('emails.php', {
		multiple: true,
		dataType: "json",
		parse: function(data) {
			return $.map(data, function(row) {
				return {
					data: row,
					value: row.companyname,
					result: row.companyname
				}
			});
		},
		formatItem: function(item) {
			return format(item);
		}
	});
});